/*
 * GkZTableModel.java
 *
 * Created on 6. November 2006, 16:37
 *
 *  This file is part of JSmex.
 *
 *  JSmex is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  JSmex is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

package jsmex.function;

import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Tobias Senger
 */
public class GkZTableModel extends AbstractTableModel{
    
    private EF_BLOG_Record[] recs;
    
    private String[] columnNames = new String [] {"BSEQ","Datum","Uhrzeit","Betrag","Status","HSEQ","Terminalnr.","KID"};
    
    /** Creates a new instance of GkZTableModel */
    public GkZTableModel(EF_BLOG_Record[] recs) {
        this.recs = recs;
    }
    
    
    /**
     *
     * @return Number of rows
     */
    public int getRowCount() {
        return recs.length;
    }
    
    /**
     *
     * @return Number of columns
     */
    public int getColumnCount() {
        return 8;
    }
    
    /** getColumnName returns the name of the column which is identified with the Parameter spalte
     *
     * @param spalte Contains column index
     * @return name of the column
     */
    public String getColumnName(int spalte) {
        return columnNames[spalte];
    }
    
    /** getValueAt returns the value of the table at row and column which is identified in the Parameters
     *
     * @param row The row to read
     * @param column The column to read
     * @return The value at row, column
     */
    public Object getValueAt(int row, int column) {
        if (recs[row]!= null) {
            switch (column) {
                case 0: return recs[row].getBSEQ();
                case 1: return recs[row].getDatum();
                case 2: return recs[row].getUhrzeit();
                case 3: return recs[row].getBetrag();
                case 4: return recs[row].getStatus();
                case 5: return recs[row].getHSEQ();
                case 6: return recs[row].getHKN();
                case 7: return recs[row].getKID();
                
                default : return null;
            }
        } else return null;
    }
}
